//
//  ZPComposeViewController.swift
//  ZPWeibo
//
//  Created by zhangpeng on 16/4/23.
//  Copyright © 2016年 zhangpeng. All rights reserved.
//

import UIKit

class ZPComposeViewController: UIViewController {

    override func viewDidLoad() {
        
    }
    @objc private func cancel(){
    
        
    }
    @objc private func send(){
        
        
    }
    
    
    private func setupNav(){
    
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "取消", style: UIBarButtonItemStyle.Plain, target: self, action: "cancel")
        
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "发送", style: UIBarButtonItemStyle.Plain, target: self, action: "send")
    }
    
    //MARK : - 设置导航栏
    private lazy var titleView:UILabel = {
     
        //用户昵称
        let name = ZPUserAccountTools.sharedTools.userAccount?.screen_name ?? ""
        //发微博
        let titleString = "发微博\n\(name)"

        //富文本
        let attr = NSMutableAttributedString(string: titleString)
        
        //获取range
        let range = (titleString as NSString).rangeOfString(name)
        
        //设置指定位置的颜色
        attr.addAttribute(NSFontAttributeName, value: UIFont.systemFontOfSize(12), range: range)
        
        let lab = UILabel(textColor: UIColor.darkGrayColor(), textFont: 15)
        lab.attributedText = attr
        
        lab.numberOfLines = 0
        lab.textAlignment = .Center
        
        lab.sizeToFit()
        return lab
    }()
    
    
}
